package com.lyy.common.sms;

import com.alibaba.fastjson.JSONObject;

import java.util.EnumMap;
import java.util.Map;

public class ALiYunSMSModel {

    public static final String SignName = "智慧工地";
    public static final String accessKeyId = "LTAI4FgVqB4xErXgsdx2BxpX";
    public static final String accessSecret = "VyBuNOqIeQYGU9hAvpEW2f6iLtrNhX";

    public static enum TEMPLATE_TYPE {
        /**
         * 验证码消息
         */
        SEND_CODE,
        /**
         * 验证码消息
         */
        SEND_HAI_HEN;
    }

    private static EnumMap<TEMPLATE_TYPE, String> getSmsTemplate() {
        EnumMap<TEMPLATE_TYPE, String> enumMap = new EnumMap<>(TEMPLATE_TYPE.class);
        enumMap.put(TEMPLATE_TYPE.SEND_CODE, "SMS_180220365");
        enumMap.put(TEMPLATE_TYPE.SEND_HAI_HEN, "SMS_205400412");
        return enumMap;
    }

    public static enum SMS_TYPE {
        /**
         * 验证码消息
         */
        SEND_CODE,
        /**
         * 验证码消息
         */
        SEND_HAI_HEN;
    }

    private static EnumMap<SMS_TYPE, String> getSmsModel(Map<String, Object> paramMap) {
        EnumMap<SMS_TYPE, String> enumMap = new EnumMap<>(SMS_TYPE.class);
        enumMap.put(SMS_TYPE.SEND_CODE, "{\"code\":\"" + paramMap.get("code") + "\"}");
        enumMap.put(SMS_TYPE.SEND_HAI_HEN, JSONObject.toJSONString(paramMap));
        return enumMap;
    }

    public static String getModelString(SMS_TYPE type, Map<String, Object> paramMap) {
        return getSmsModel(paramMap).get(type);
    }

    public static String getTemplateString(TEMPLATE_TYPE type) {
        return getSmsTemplate().get(type);
    }
}